/*
 Navicat Premium Dump SQL

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80403 (8.4.3)
 Source Host           : 127.0.0.1:3306
 Source Schema         : uni_admin_sql

 Target Server Type    : MySQL
 Target Server Version : 80403 (8.4.3)
 File Encoding         : 65001

 Date: 10/10/2025 10:22:15
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for alembic_version
-- ----------------------------
DROP TABLE IF EXISTS `alembic_version`;
CREATE TABLE `alembic_version` (
  `version_num` varchar(32) COLLATE utf8mb4_general_ci NOT NULL,
  PRIMARY KEY (`version_num`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of alembic_version
-- ----------------------------
BEGIN;
INSERT INTO `alembic_version` (`version_num`) VALUES ('28881eac2ffe');
COMMIT;

-- ----------------------------
-- Table structure for uni_admin
-- ----------------------------
DROP TABLE IF EXISTS `uni_admin`;
CREATE TABLE `uni_admin` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '管理员ID',
  `account` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录账号',
  `password` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录密码（已加密）',
  `nickname` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '昵称',
  `phone` varchar(11) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手机号',
  `email` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电子邮箱',
  `avatar` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '头像 URL',
  `is_super` tinyint(1) NOT NULL COMMENT '是否超级管理员',
  `is_locked` tinyint(1) NOT NULL COMMENT '是否锁定',
  `last_login` datetime DEFAULT NULL COMMENT '最后登录时间',
  `last_ip` varchar(45) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '登录 IP',
  `types` int NOT NULL COMMENT '管理员类型 0-后台添加',
  `accept_ms` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '可接受消息类型，逗号分隔，1-订单 2-提现 …',
  `created_at` datetime NOT NULL DEFAULT (now()) COMMENT '创建时间',
  `updated_at` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `account` (`account`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='管理员表';

-- ----------------------------
-- Records of uni_admin
-- ----------------------------
BEGIN;
INSERT INTO `uni_admin` (`id`, `account`, `password`, `nickname`, `phone`, `email`, `avatar`, `is_super`, `is_locked`, `last_login`, `last_ip`, `types`, `accept_ms`, `created_at`, `updated_at`) VALUES (1, 'admin', '$2b$12$Mtc1ugfkP5oVaUrv47icwudt9inmW0v7XknT9.BWHAw2TmOBOQjOi', '超级管理员', '13999821190', NULL, NULL, 1, 0, '2025-10-09 11:41:34', NULL, 0, NULL, '2025-09-08 13:53:04', '2025-10-09 11:41:34');
COMMIT;

-- ----------------------------
-- Table structure for uni_admin_log
-- ----------------------------
DROP TABLE IF EXISTS `uni_admin_log`;
CREATE TABLE `uni_admin_log` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '操作日志ID',
  `admin_id` bigint DEFAULT NULL COMMENT '操作人ID',
  `account` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作人账号',
  `method` varchar(7) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'HTTP 方法',
  `uri` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求路径',
  `req_param` text COLLATE utf8mb4_general_ci COMMENT '请求参数(JSON)',
  `status_code` smallint NOT NULL COMMENT 'HTTP 状态码',
  `result` text COLLATE utf8mb4_general_ci COMMENT '响应体(JSON)',
  `result_msg` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '业务提示消息',
  `ip` varchar(45) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作IP',
  `web_browser` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '浏览器 UA',
  `os_name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作系统',
  `desc_message` text COLLATE utf8mb4_general_ci COMMENT '操作内容描述',
  `types` smallint NOT NULL COMMENT '日志类型 0-登录 1-查询 2-新增 3-修改 4-删除 5-上传 100-其他',
  `created_at` datetime NOT NULL DEFAULT (now()) COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='管理员操作日志表';

-- ----------------------------
-- Records of uni_admin_log
-- ----------------------------
BEGIN;
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (7, 1, 'admin', 'DELETE', '/admin/menus/delete/18', '{\"_t\": \"1759981046452\"}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"删除目录成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '删除目录/菜单/按钮', 3, '2025-10-09 11:37:26');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (8, 0, 'admin', 'POST', '/admin/login', '{\"username\": \"admin\", \"captcha\": \"thgj\", \"captcha_key\": \"8cb965c5-efd7-42d4-9294-044a9654bc09\"}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"登录成功\", \"data\": {\"id\": \"AID000001\", \"account\": \"admin\", \"nickname\": \"超级管理员\", \"avatar\": null, \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsImV4cCI6MTc2MDE5NzI5NH0.PZdNuuX_MlSOQn0SNklOJcGurzmR8fSU7uxT9V7sWF4\", \"expire_time\": 1760197294000, \"authorities\": [\"admin:list\", \"role:list\", \"menus:lists\", \"menus:save\", \"menus:update\", \"menus:delete\", \"admin:log:lists\", \"role:save\", \"role:update\", \"role:delete\", \"admin:save\", \"admin:edit\", \"admin:delete\"], \"menus\": [{\"path\": \"/settings\", \"name\": \"settings\", \"meta\": {\"title\": \"设置\", \"icon\": \"tabler-Settings\", \"hide_in_menu\": 0}, \"component\": \"Layout\", \"children\": [{\"path\": \"accounts\", \"name\": \"accounts\", \"meta\": {\"title\": \"账号管理\", \"hide_in_menu\": 0}, \"component\": \"/settings/accounts\"}, {\"path\": \"role\", \"name\": \"role\", \"meta\": {\"title\": \"角色管理\", \"hide_in_menu\": 0}, \"component\": \"/settings/role\"}, {\"path\": \"menus\", \"name\": \"menus\", \"meta\": {\"title\": \"菜单管理\", \"hide_in_menu\": 0}, \"component\": \"/settings/menus\"}, {\"path\": \"logs\", \"name\": \"logs\", \"meta\": {\"title\": \"操作日志\", \"hide_in_menu\": 0}, \"component\": \"/settings/account_log\"}]}]}}', '登录成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '登录', 0, '2025-10-09 11:41:34');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (9, 1, 'admin', 'POST', '/admin/role/save', '{\"id\": 0, \"name\": \"aaa\", \"desc\": \"aaa\", \"permissions\": [15, 2, 1]}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"新增角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '新增角色', 1, '2025-10-09 13:04:56');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (10, 1, 'admin', 'PUT', '/admin/role/save', '{\"id\": 1, \"name\": \"aaa\", \"desc\": \"aaa\", \"permissions\": [15, 2, 1, 17]}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"编辑角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '编辑角色', 2, '2025-10-09 13:06:57');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (11, 1, 'admin', 'PUT', '/admin/role/save', '{\"id\": 1, \"name\": \"aaa\", \"desc\": \"aaa\", \"permissions\": [15, 2, 1, 17, 16, 13, 3]}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"编辑角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '编辑角色', 2, '2025-10-09 13:17:07');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (12, 1, 'admin', 'DELETE', '/admin/role/delete/1', '{\"_t\": \"1759987407397\"}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"删除角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '删除角色', 3, '2025-10-09 13:23:27');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (13, 1, 'admin', 'POST', '/admin/role/save', '{\"id\": 0, \"name\": \"asda\", \"desc\": \"adasd\", \"permissions\": [2, 1]}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"新增角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '新增角色', 1, '2025-10-09 13:33:32');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (14, 1, 'admin', 'DELETE', '/admin/role/delete/2', '', 200, '{\"code\": 200, \"status\": 0, \"message\": \"删除角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '删除角色', 3, '2025-10-09 13:33:35');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (15, 1, 'admin', 'POST', '/admin/role/save', '{\"id\": 0, \"name\": \"a\", \"desc\": \"aaa\", \"permissions\": [15, 2, 1]}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"新增角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '新增角色', 1, '2025-10-09 15:45:24');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (16, 1, 'admin', 'POST', '/admin/role/save', '{\"id\": 0, \"name\": \"b\", \"desc\": \"b\", \"permissions\": [16, 2, 1, 17]}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"新增角色成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '新增角色', 1, '2025-10-09 15:45:33');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (17, 1, 'admin', 'PUT', '/admin/menus/save', '{\"id\": 1, \"label\": \"\\u8bbe\\u7f6e\", \"name\": \"settings\", \"p_id\": 0, \"types\": 1, \"code\": null, \"e_link\": 0, \"url\": null, \"is_hide\": 0, \"icon\": \"tabler-Settings\", \"sort\": 2, \"parent\": \"\\u9876\\u7ea7\\u83dc\\u5355\", \"hide_menu\": 0, \"created_at\": \"2025-09-08 17:50:10\"}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"编辑目录成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '编辑目录/菜单/按钮', 2, '2025-10-09 17:51:15');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (18, 1, 'admin', 'PUT', '/admin/menus/save', '{\"id\": 2, \"label\": \"\\u8d26\\u53f7\\u7ba1\\u7406\", \"name\": \"accounts\", \"p_id\": 1, \"types\": 2, \"code\": \"admin:list\", \"e_link\": 0, \"url\": \"/settings/accounts\", \"is_hide\": 0, \"icon\": null, \"sort\": 1, \"parent\": \"\\u8bbe\\u7f6e\", \"hide_menu\": 0, \"created_at\": \"2025-09-08 18:27:15\"}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"编辑菜单成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '编辑目录/菜单/按钮', 2, '2025-10-09 17:52:37');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (19, 1, 'admin', 'PUT', '/admin/menus/save', '{\"id\": 2, \"label\": \"\\u8d26\\u53f7\\u7ba1\\u7406\", \"name\": \"accounts\", \"p_id\": 1, \"types\": 2, \"code\": \"admin:list\", \"e_link\": 0, \"url\": \"/settings/accounts\", \"is_hide\": 0, \"icon\": null, \"sort\": 1, \"parent\": \"\\u8bbe\\u7f6e\", \"hide_menu\": 0, \"created_at\": \"2025-09-08 18:27:15\"}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"编辑菜单成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '编辑目录/菜单/按钮', 2, '2025-10-09 17:52:57');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (20, 1, 'admin', 'POST', '/admin/admins/save', '{\"id\": 0, \"account\": \"adsada\", \"nickname\": \"adad\", \"phone\": null, \"email\": null, \"is_locked\": 0, \"role\": 3}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"新增管理员成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '新增管理员', 1, '2025-10-09 18:58:58');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (21, 1, 'admin', 'DELETE', '/admin/menus/delete/20', '', 200, '{\"code\": 200, \"status\": 0, \"message\": \"删除菜单成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '删除目录/菜单/按钮', 3, '2025-10-09 19:09:32');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (22, 1, 'admin', 'DELETE', '/admin/menus/delete/19', '', 200, '{\"code\": 200, \"status\": 0, \"message\": \"删除目录成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '删除目录/菜单/按钮', 3, '2025-10-09 19:09:35');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (23, 1, 'admin', 'POST', '/admin/admins/save', '{\"id\": 0, \"account\": \"aaa\", \"nickname\": \"aaa\", \"phone\": null, \"email\": null, \"is_locked\": 0, \"role\": 3}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"新增管理员成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '新增管理员', 1, '2025-10-09 19:18:56');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (24, 1, 'admin', 'PUT', '/admin/admins/save', '{\"id\": 2, \"account\": \"aaa\", \"nickname\": \"aaa\", \"phone\": null, \"email\": \"a@163.com\", \"is_locked\": 0, \"role\": 3}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"编辑管理员成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '编辑管理员', 2, '2025-10-09 19:20:27');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (25, 1, 'admin', 'POST', '/admin/admins/save', '{\"id\": 0, \"account\": \"bbbb\", \"nickname\": \"bbb\", \"phone\": null, \"email\": null, \"is_locked\": 0, \"role\": 4}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"新增管理员成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '新增管理员', 1, '2025-10-09 19:34:10');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (26, 1, 'admin', 'PUT', '/admin/admins/save', '{\"id\": 3, \"account\": \"bbbb\", \"nickname\": \"bbb\", \"phone\": null, \"email\": \"aaa@126.com\", \"is_locked\": 0, \"role\": 4}', 200, '{\"code\": 200, \"status\": 0, \"message\": \"编辑管理员成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '编辑管理员', 2, '2025-10-09 19:34:28');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (27, 1, 'admin', 'DELETE', '/admin/admins/delete/2', '', 200, '{\"code\": 200, \"status\": 0, \"message\": \"删除管理员(账号)成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '删除管理员', 3, '2025-10-09 19:37:59');
INSERT INTO `uni_admin_log` (`id`, `admin_id`, `account`, `method`, `uri`, `req_param`, `status_code`, `result`, `result_msg`, `ip`, `web_browser`, `os_name`, `desc_message`, `types`, `created_at`) VALUES (28, 1, 'admin', 'DELETE', '/admin/admins/delete/3', '', 200, '{\"code\": 200, \"status\": 0, \"message\": \"删除管理员(账号)成功\", \"data\": null}', '操作成功', '127.0.0.1', 'Chrome(140.0.0)', 'Mac OS X(10.15.7)', '删除管理员', 3, '2025-10-09 19:38:15');
COMMIT;

-- ----------------------------
-- Table structure for uni_admin_role
-- ----------------------------
DROP TABLE IF EXISTS `uni_admin_role`;
CREATE TABLE `uni_admin_role` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '管理员角色ID',
  `admin_id` bigint NOT NULL COMMENT '管理员ID',
  `role_id` bigint NOT NULL COMMENT '角色ID',
  PRIMARY KEY (`id`),
  KEY `admin_id` (`admin_id`),
  CONSTRAINT `uni_admin_role_ibfk_1` FOREIGN KEY (`admin_id`) REFERENCES `uni_admin` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='管理员-角色关联表';

-- ----------------------------
-- Records of uni_admin_role
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for uni_agreements
-- ----------------------------
DROP TABLE IF EXISTS `uni_agreements`;
CREATE TABLE `uni_agreements` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '协议ID',
  `types` enum('USER_AGREEMENT','PRIVACY_POLICY','TERMS_OF_SERVICE','COOKIE_POLICY') COLLATE utf8mb4_general_ci NOT NULL COMMENT '协议类型',
  `title` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '协议标题',
  `content` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '协议内容',
  `version` int NOT NULL COMMENT '版本号, 同一类型下应是唯一的',
  `status` enum('DRAFT','PUBLISHED','ARCHIVED') COLLATE utf8mb4_general_ci NOT NULL COMMENT '状态：0=草稿,1=已发布,2=已归档',
  `created_at` datetime NOT NULL DEFAULT (now()) COMMENT '创建时间',
  `updated_at` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_agreement_type_version` (`types`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='协议管理表';

-- ----------------------------
-- Records of uni_agreements
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for uni_configs
-- ----------------------------
DROP TABLE IF EXISTS `uni_configs`;
CREATE TABLE `uni_configs` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '配置ID',
  `types` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置类型',
  `key` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置键',
  `value` text COLLATE utf8mb4_general_ci COMMENT '配置参数(Json)',
  `enable` tinyint(1) NOT NULL COMMENT '状态  True:启用  False:停用',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统配置表';

-- ----------------------------
-- Records of uni_configs
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for uni_img_groups
-- ----------------------------
DROP TABLE IF EXISTS `uni_img_groups`;
CREATE TABLE `uni_img_groups` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分组ID',
  `name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '分组名称',
  `created_at` datetime NOT NULL DEFAULT (now()) COMMENT '创建时间',
  `updated_at` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='图片分组表';

-- ----------------------------
-- Records of uni_img_groups
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for uni_imgs
-- ----------------------------
DROP TABLE IF EXISTS `uni_imgs`;
CREATE TABLE `uni_imgs` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '图片ID',
  `name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '图片原始名称',
  `group_id` bigint DEFAULT NULL COMMENT '分组ID',
  `src` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '图片地址',
  `created_at` datetime NOT NULL DEFAULT (now()) COMMENT '创建时间',
  `updated_at` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='图片管理表';

-- ----------------------------
-- Records of uni_imgs
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for uni_menu
-- ----------------------------
DROP TABLE IF EXISTS `uni_menu`;
CREATE TABLE `uni_menu` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '菜单目录ID',
  `label` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称',
  `p_id` bigint NOT NULL COMMENT '上级菜单目录ID',
  `p_label` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '上级菜单目录名称',
  `types` smallint NOT NULL COMMENT '类型 1:目录 2:菜单 3:按钮',
  `code` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '权限码',
  `e_link` tinyint(1) NOT NULL COMMENT '是否外部链接',
  `url` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '地址(组件路径，外部链接)',
  `is_hide` tinyint(1) NOT NULL COMMENT '是否菜单中隐藏 True:是  False:否',
  `icon` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '菜单图标',
  `sort` int DEFAULT NULL COMMENT '序列',
  `is_delete` tinyint(1) DEFAULT NULL COMMENT '软删除  True:删除  False:否',
  `created_at` datetime NOT NULL DEFAULT (now()) COMMENT '创建时间',
  `updated_at` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='菜单目录表';

-- ----------------------------
-- Records of uni_menu
-- ----------------------------
BEGIN;
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (1, '设置', 'settings', 0, '顶级菜单', 1, NULL, 0, NULL, 0, 'tabler-Settings', 2, 0, '2025-09-08 17:50:10', '2025-10-09 17:51:15');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (2, '账号管理', 'accounts', 1, '设置', 2, 'admin:list', 0, '/settings/accounts', 0, NULL, 1, 0, '2025-09-08 18:27:15', '2025-10-08 18:50:15');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (3, '角色管理', 'role', 1, '设置', 2, 'role:list', 0, '/settings/role', 0, NULL, 100, 0, '2025-09-08 18:35:07', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (4, '菜单管理', 'menus', 1, '设置', 2, 'menus:lists', 0, '/settings/menus', 0, NULL, 100, 0, '2025-09-08 18:59:13', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (5, '新增', NULL, 4, '菜单管理', 3, 'menus:save', 0, NULL, 0, NULL, 100, 0, '2025-09-08 19:00:12', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (6, '编辑', NULL, 4, '菜单管理', 3, 'menus:update', 0, NULL, 0, NULL, 100, 0, '2025-09-08 19:01:08', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (7, '删除', NULL, 4, '菜单管理', 3, 'menus:delete', 0, NULL, 0, NULL, 100, 0, '2025-09-08 19:03:59', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (10, '操作日志', 'logs', 1, '设置', 2, 'admin:log:lists', 0, '/settings/account_log', 0, NULL, 100, 0, '2025-09-09 10:57:10', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (12, '新增', NULL, 3, '角色管理', 3, 'role:save', 0, NULL, 0, NULL, 100, 0, '2025-09-09 16:44:20', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (13, '编辑', NULL, 3, '角色管理', 3, 'role:update', 0, NULL, 0, NULL, 100, 0, '2025-09-09 16:44:43', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (14, '删除', NULL, 3, '角色管理', 3, 'role:delete', 0, NULL, 0, NULL, 100, 0, '2025-09-09 16:45:24', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (15, '新增', NULL, 2, '账号管理', 3, 'admin:save', 0, NULL, 0, NULL, 100, 0, '2025-09-11 17:26:05', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (16, '编辑', NULL, 2, '账号管理', 3, 'admin:edit', 0, NULL, 0, NULL, 100, 0, '2025-09-11 17:26:22', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (17, '删除', NULL, 2, '账号管理', 3, 'admin:delete', 0, NULL, 0, NULL, 100, 0, '2025-09-11 17:26:38', '2025-09-11 18:36:50');
INSERT INTO `uni_menu` (`id`, `label`, `name`, `p_id`, `p_label`, `types`, `code`, `e_link`, `url`, `is_hide`, `icon`, `sort`, `is_delete`, `created_at`, `updated_at`) VALUES (21, '系统设置', 'sett', 1, '设置', 2, 'sett:list', 0, '/settings/sett', 0, NULL, 1, 0, '2025-10-10 11:00:12', NULL);
COMMIT;



-- ----------------------------
-- Table structure for uni_roles
-- ----------------------------
DROP TABLE IF EXISTS `uni_roles`;
CREATE TABLE `uni_roles` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID',
  `name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称',
  `desc` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色描述',
  `permissions` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色权限',
  `created_at` datetime NOT NULL DEFAULT (now()) COMMENT '创建时间',
  `updated_at` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色管理表';

-- ----------------------------
-- Records of uni_roles
-- ----------------------------
BEGIN;
INSERT INTO `uni_roles` (`id`, `name`, `desc`, `permissions`, `created_at`, `updated_at`) VALUES (3, 'a', 'aaa', '15,2,1', '2025-10-09 15:45:24', NULL);
INSERT INTO `uni_roles` (`id`, `name`, `desc`, `permissions`, `created_at`, `updated_at`) VALUES (4, 'b', 'b', '16,2,1,17', '2025-10-09 15:45:33', NULL);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
